package day06.practise;

import java.util.Random;
import java.util.Scanner;

//猜数
public class GuessNum {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        Random random=new Random();
        int num=random.nextInt(1000)+1;

        while(true){
            System.out.println("猜测的数:");
            int guess=scanner.nextInt();
            if (num<guess){
                System.out.println("大了");
            }else if (num>guess){
                System.out.println("小了");
            }else {
                System.out.println("猜对了");
                break;
            }
        }
    }
}
